package com.lyl.common.validation.annotation;

import com.lyl.common.validation.validator.FileNotEmptyConstraintValidatorWithHttpServletRequest;
import com.lyl.common.validation.validator.FileNotEmptyConstraintValidatorWithMultipartFile;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * @author 罗亚龙
 * @date 2021/9/25 8:59
 */
@Target({ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@Constraint(validatedBy = {FileNotEmptyConstraintValidatorWithHttpServletRequest.class, FileNotEmptyConstraintValidatorWithMultipartFile.class})
public @interface FileNotEmpty {
    //配置文件中错误提示信息的名称
    String message() default "文件不能为空";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    /**
     * 字段名
     * @return 字段名
     */
    String value() default "file";
}
